
<extend name="Common/header"/>

<block name='content'>
<link rel="stylesheet" type="text/css" href="__PUBLIC_HOME__css/comment.css">
<section class="container">
<div class="content-wrap">
<div class="content">
  <header class="article-header">
	<h1 class="article-title"><a href="#" title="{$blog['title']}" >{$blog['title']}</a></h1>
	<div class="article-meta"> 
	<span class="item article-meta-time">
	  <time class="time" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="发表时间：{$blog['time']|date='Y-m-d',###}"><i class="glyphicon glyphicon-time"></i> {$blog['time']|date='Y-m-d',###}</time>
	  </span> 
	  <span class="item article-meta-source" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="来源：{$blog['source']}"><i class="glyphicon glyphicon-globe"></i> {$blog['source']}</span> 
	  <span class="item article-meta-category" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="<volist name="cats" id="v"><if condition="$v['cat_id']==$blog['cat_id']">{$v['cat_name']}</if></volist>"><i class="glyphicon glyphicon-list"></i> <a href="#" title="<volist name="cats" id="v"><if condition="$v['cat_id']==$blog['cat_id']">{$v['cat_name']}</if></volist>" ><volist name="cats" id="v"><if condition="$v['cat_id']==$blog['cat_id']">{$v['cat_name']}</if></volist></a></span> 
	  <span class="item article-meta-views" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="浏览量：{$blog['count']}"><i class="glyphicon glyphicon-eye-open"></i> {$blog['count']}</span> 
	  <i class="glyphicon glyphicon-comment"></i><span class="item article-meta-comment" id="contact_count" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="评论量"> {$blog['contact_count']}</span>
	  <span class="item article-meta-views" data-toggle="tooltip" data-placement="bottom" title="" onclick="collection(this,{$blog['id']})"><if condition="$state == 1">已收藏<else/>收藏</if></span>  </div>
  </header>
  <article class="article-content">
	{$blog['content']}
	<div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a><a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a></div>

		  <script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "1", "bdSize": "32" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=0.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
  </article>
  <div class="article-tags">标签：
  
  <volist name="keys" id="v">
  <a href="###" rel="tag" >{$v['key_name']}</a>
  </volist>
	</div>
  <div class="relates">
	<div class="title">
	  <h3>相关推荐</h3>
	</div>
	<ul>
	<volist name="xiangguan" id="v">
	  <li><a href="{:U('index',array('blog_id'=>$v['id']))}" title="" >{$v['title']}-{$v['cat_name']}</a></li>
	</volist>
	 
	</ul>
  </div>
  <div class="title" id="comment">
	<h3>评论</h3>
  </div>
  <div id="respond">
		<form id="comment-form" name="comment-form" action="" method="POST">
			<div class="comment">
				<div id="postcomments">
				<ol id="comment_list" class=""> 
				<volist name="comments" id="v" key="k">       
				<li class="">
					<div id="comment">
						<img src="__PUBLIC_HOME__1234.jpg" />
						
						{:getComment($blog_id,$v['pid'])}
						
						<h5>{$v['username']}</h5>
						<p>{$v['content']}</p>
						<div class="contact"><a onclick="good(this,{$v['id']})">顶[<span>{$v['good_count']}</span>]</a><a onclick="bad(this,{$v['id']})">踩[<span>{$v['bad_count']}</span>]</a><a onclick="contact_back(this)">回复</a></div>
						<div class="comment-box lou_comment" style="display: none;">
					<textarea placeholder="您的评论或留言（必填）" name="content" id="comment-textarea" cols="100%" rows="3" tabindex="3"></textarea>
					<div class="comment-ctrl">
						<div class="comment-prompt" style="display: none;"> <i class="fa fa-spin fa-circle-o-notch"></i> <span class="comment-prompt-text">回复正在提交中...请稍后</span> </div>
						<div class="comment-success" style="display: none;"> <i class="fa fa-check"></i> <span class="comment-prompt-text">回复成功...</span> </div>
						<button type="button" onclick="comment(this,'{:U('Comment/commentBack',array('comment_id'=>$v['id']))}')" name="comment-submit" id="comment-submit" tabindex="4">回复</button>
					</div>
				</div>
					</div>
				</li>
				</volist>
				</ol>
			  </div>
			  
				<div class="comment-box">
					<textarea placeholder="您的评论或留言（必填）" name="content" id="comment-textarea" cols="100%" rows="3" tabindex="3"></textarea>
					<div class="comment-ctrl">
						<div class="comment-prompt" style="display: none;"> <i class="fa fa-spin fa-circle-o-notch"></i> <span class="comment-prompt-text">评论正在提交中...请稍后</span> </div>
						<div class="comment-success" style="display: none;"> <i class="fa fa-check"></i> <span class="comment-prompt-text">评论提交成功...</span> </div>
						<button type="button" onclick="comment(this,'{:U('Comment/comment',array('blog_id'=>$blog_id))}')" name="comment-submit" id="comment-submit" tabindex="4">评论</button>
					</div>
				</div>
			</div>
		</form>
		
	</div>
  
</div>
</div>
	
<aside class="sidebar">
<div class="fixed">
  <div class="widget widget-tabs">
	<ul class="nav nav-tabs" role="tablist">
	  <li role="presentation" class="active"><a href="#notice" aria-controls="notice" role="tab" data-toggle="tab" >统计信息</a></li>
	  <li role="presentation"><a href="#contact" aria-controls="contact" role="tab" data-toggle="tab" >联系站长</a></li>
	</ul>
	<div class="tab-content">
	  <div role="tabpanel" class="tab-pane contact active" id="notice">
		<h2>博客总数:
			  {$all_blog}篇
		  </h2>
		  <h2>网站运行:
		  <span id="sitetime">88天 </span></h2>
	  </div>
		<div role="tabpanel" class="tab-pane contact" id="contact">
		  <h2>QQ:
			  <a href="" target="_blank" rel="nofollow" data-toggle="tooltip" data-placement="bottom" title=""  data-original-title="QQ">{$contact[0]['value']}</a>
		  </h2>
		  <h2>Email:
		  <a href="#" target="_blank" data-toggle="tooltip" rel="nofollow" data-placement="bottom" title=""  data-original-title="email">{$contact[1]['value']}</a></h2>
	  </div>
	</div>
  </div>
  <div class="widget widget_search">
	<form class="navbar-form" action="{:U('Search/index')}" method="get">
	  <div class="input-group">
		<input type="text" name="keyword" class="form-control" size="35" placeholder="请输入关键字" maxlength="15" autocomplete="off">
		<span class="input-group-btn">
		<button class="btn btn-default btn-search" name="search" type="submit">搜索</button>
		</span> </div>
	</form>
  </div>
</div>
{:W('New/hotBlog')}
 <div class="widget widget_sentence">    
	<a href="#" target="_blank" rel="nofollow" title="专业网站建设" >
	<img style="width: 100%" src="__PUBLIC_HOME__images//201610241224221511.jpg" alt="专业网站建设" ></a>    
 </div>
 
</aside>
</section>
<footer class="footer">
<div class="container">
 <p>{$copyright}</p>
</div>
<div id="gotop"><a class="gotop"></a></div>
</footer>

<script>
	//收藏文章
	function collection(obj,blog_id){
		$.post('{:U("collection")}',{blog_id:blog_id},function(data){
			if(data.status == 1){
				if(data.state == 1){ // 已收藏
					$(obj).text('已收藏');
				}else { // 未收藏
					$(obj).text('收藏')
				}
			}else{
				layer.msg(data.msg,{icon:5,time:1000});
			}
		});
	}

	function contact_back(obj){
		
		var comment = $(obj).parent('.contact').next('div');
		if(comment.css('display') == 'none'){
			$('.lou_comment').slideUp();
			
			comment.slideToggle();
		}else{
			comment.slideToggle();
		}
		
		
	}
	function comment(obj,url){
		
		$(obj).prev().prev().show();
		// 获取表单中的值
		var content = $(obj).parent('div').prev().val();
		
		$.post(url,{content:content,blog_id:{$blog_id}},function (data){
			if(data.status == 1){
				$(obj).prev().prev().hide(400,function (){
					$(obj).prev().show();
					setTimeout(function(){
						$(obj).prev().hide();
						location.reload();
					},500);
					var count = parseInt($("#contact_count").text())+1;
					$("#contact_count").text(' '+count);
					$('textarea[name=content]').val('');
				});
				
			}else{
				$(obj).prev().prev().hide();
				alert(data.msg);
			}
			
		});
	}
	
	function good(obj,id){
		$.post('{:U('Comment/good')}',{id:id},function(data){
			if(data == 1){
				var count = parseInt($(obj).find('span').text()) + 1;
				$(obj).find('span').text(count);
			}
		});
	}
	function bad(obj,id){
		$.post('{:U('Comment/bad')}',{id:id},function(data){
			if(data == 1){
				var count = parseInt($(obj).find('span').text()) + 1;
				$(obj).find('span').text(count);
			}
		});
	}
</script>
</block>
